# coding:utf-8
import urllib
import os

class d_common:
        version=""
        author=""
        date=""
        about=""
        dict_name=""
        option=""
        
        def __init__(self,dict_name,about,author,version,date):
                self.version=version
                self.author=author
                self.date=date
                self.about=about
                self.dict_name=dict_name
        
        def __del__(self):
                pass
        
        def __str__(self):
                str='''<html>
                <title>%s</title>
                <h2>%s</h2>
                <br/>
                <p>%s</p>
                <p>%s : %s</p>
                <p>%s : %s</p>
                <p>%s : %s</p>
               </html>'''
                
                return  str % (self.dict_name,self.dict_name,self.about,_("author"),self.author,_("version"),self.version,_("last modified"),self.date)
        
        def getdict_name(self):
                return self.dict_name
        
        def getabout(self):
                return self.about
        
        def getauthor(self):
                return self.author
        
        def getversion(self):
                return self.version
        
        def getdate(self):
                return self.date
	
        def setoptiongui(self,parent):
		pass
	
        def setoption(self,op,val):
                pass
        
        def getoption(self,op):
                pass
	
        def getmp3(self,word,read,parent):
		pass
	
        def getcontent(self,word):
                pass
        
        def getcontentHTML(self,word):
                pass
        
        def getmp3(self,word,parent):
                pass
	def getwordlist(self):
		pass



def getsource(url):
        page = urllib.urlopen(url)
        html = page.read()
        page.close()
        return html

def delete_file_folder(src,exclude=""):
	for item in os.listdir(src):
		if item==exclude:
			continue
		itemsrc=os.path.join(src,item)
		os.remove(itemsrc)